<html>
<head>
<script src="selectuser.js"></script>
<SCRIPT LANGUAGE="JavaScript">
function addNames() {

  mailList = window.document.forms['A'].elements['F'];
  srcList = window.document.forms['mainform'].elements['M'];

  if (mailList.options[0].text == "No Items Selected") {
    mailList.options[0] = null;
  }
  var len = mailList.length;
  for(var i = 0; i < srcList.length; i++) {
    if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
      //Check if this value already exist in the destList or not
      //if not then add it, otherwise do not add it.
      var found = false;
      for(var count = 0; count < len; count++) {
        if (mailList.options[count] != null) {
          if (srcList.options[i].text == mailList.options[count].text) {
            found = true;
            break;
          }
        }
      }
      //if (found != true) {
        mailList.options[len] = new Option(srcList.options[i].text);
        len++;
        //}
      }
   }

   }

</script>

</head>
<body>

<form name="A">
Select a User:
<select name="users" onchange="showUser(this.value)">
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Glenn Quagmire</option>
<option value="4">Joseph Swanson</option>
</select>



<select name="F" multiple size="10" style="width: 215px;">

<OPTION>No Items Selected</OPTION>
</select>

	<INPUT id="nameAdd" onclick="javascript:addNames()" type="button" value="Add Item(s)>>" name="nameAdd">

</form>

<p>

	
<div id="txtHint"><b>User info will be listed here.</b>
<form name="mainform">	<select name="M" size=3 multiple>"
</select>
</form>


</div>

</p>

</body>
</html>